package com.guigu.www.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.www.dao.XmfmMapper;
import com.guigu.www.pojo.Xmfm;
import com.guigu.www.service.XmfmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class XmfmServiceImpl implements XmfmService {
    @Autowired
    private XmfmMapper xmfmMapper;
    @Override
    public List<Xmfm> queryAll() {
        List<Xmfm> xmfms = xmfmMapper.queryAll();
        return xmfms;
    }

    @Override
    public Xmfm queryByid(int id) {
        return xmfmMapper.selectByPrimaryKey(id);
    }

    @Override
    public PageInfo<Xmfm> feye(int index,String xmm) {
        PageHelper.startPage(index,3);
        List<Xmfm> feye = xmfmMapper.feye(xmm);
        PageInfo<Xmfm> pageInfo=new PageInfo<>(feye);
        return pageInfo;
    }

    @Override
    public int xg(Xmfm xmfm) {
        return xmfmMapper.updateByPrimaryKey(xmfm);
    }

    @Override
    public int tj(Xmfm xmfm) {
        return xmfmMapper.insert(xmfm);
    }
}
